// subpkg_user/pages/profile/index.js
let app = getApp()
Page({
  data: {
    nickname: wx.getStorageSync('nickname'),
    avatar: wx.getStorageSync('avatar')
  },
  getUserNickname(ev) {
    // 存储用户昵称
    wx.setStorageSync('nickname', ev.detail.value)
    // 更新应用实例
    app.nickname = ev.detail.value
  },
  getUserAvatar(ev) {
    // 存储头像地址
    wx.setStorageSync('avatar', ev.detail.avatarUrl)
    // 页面中渲染数据
    this.setData({avatar: ev.detail.avatarUrl})
  }
})